import { createRouter, createWebHistory } from 'vue-router';
import Home from '@/components/Home.vue';
import UserList from '@/components/UserList.vue'; // 确保这些组件已经创建
import AddUser from '@/components/AddUser.vue';
import EditUser from '@/components/EditUser.vue';


const routes = [
    {
        path: '/',
        name: 'Home',
        component: Home
    },
    {
        path: '/users',
        name: 'UserList',
        component: UserList
    },
    {
        path: '/add-user',
        name: 'AddUser',
        component: AddUser
    },
    {
        path: '/edit-user',
        name: 'EditUser',
        component: EditUser
    },
    {
        path: '/edit-user/:id',
        name: 'EditUser',
        component: EditUser
    }

];

const router = createRouter({
    history: createWebHistory(),
    routes
});

export default router;
